package controllers

import (
	"github.com/astaxie/beego"
)

type MainController struct {
	beego.Controller
}

func (c *MainController) Get() {
	c.TplName = "index.html"
}

func (c *MainController) Index_v1() {
	c.TplName = "index_v1.html"
}
func (c *MainController)Login() {
	if uid:=c.GetSession("uid");uid!=nil{
		c.Redirect("/",302)
	}
	id:=c.GetString("user")
	pass:=c.GetString("pass")
	if id=="admin@admin.com" && pass=="admin123"{
		c.SetSession("uid",1)
		c.Redirect("/",302)
	}
	c.TplName="login.html"
}

func (c *MainController)Logout() {
	c.DelSession("uid")
	c.Redirect("/login",302)
}